package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2020/5/29 10:52
 * @since v1.0
 */
public enum BusinessRuleExecuteEnum {

    /**
     * 业务规则执行枚举
     */

    SUCCESS(1, "enum.businessRuleExecute.message.success"),

    SELF_ERROR(2, "enum.businessRuleExecute.message.self_error"),

    PASSIVE_ERROR(3, "enum.businessRuleExecute.message.passive_error"),

    DATA_LARGE_ERROR(4, "enum.businessRuleExecute.message.data_large_error"),

    // 没有检索到数据
    NO_DATA(5, "enum.businessRuleExecute.message.no_data"),

    // 业务逻辑执行失败
    BUSINESS_ERROR(6, "enum.businessRuleExecute.message.business_error"),
    // 生产者报错
    PRODUCER_ERROR(7, "enum.businessRuleExecute.message.producer_error"),
    // 获取锁失败
    GET_LOCK_ERROR(8, "enum.businessRuleExecute.message.get_lock_error"),

    PRECONDITION_CHECK_FAILED(8, "enum.businessRuleExecute.message.precondition_check_failed"),

    ;

    private Integer code;

    private String message;

    BusinessRuleExecuteEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return I18nMessageUtil.getMessage(message);
    }
}
